Skip to content

docs(auth): document fine-grained PAT permission for org publishing (+ pagination-cap test)#1435

Merged
rdimitrov merged 2 commits into
mainfrom
docs/finegrained-pat-org-publishing
Jul 10, 2026
Merged

docs(auth): document fine-grained PAT permission for org publishing (+ pagination-cap test)#1435
rdimitrov merged 2 commits into
mainfrom
docs/finegrained-pat-org-publishing

Conversation

@rdimitrov

Copy link
Copy Markdown
Member

Follow-up to #1383, surfaced while validating that change end-to-end against staging.

Why

#1383 hardened org-namespace publishing to require Owner (admin) role, read via GET /user/memberships/orgs. Validating on staging revealed a gap: the docs only mention the classic read:org scope, but a fine-grained PAT (GitHub's recommended token type) needs a different permission to expose org membership. Without it, GitHub returns no org memberships for the token, so the exchange silently grants only the personal namespace — with no hint why org publishing "doesn't work."

This is not a code bug (the behavior is fail-closed and correct given GitHub's response); it's a documentation/UX gap.

What

  • Docs (authentication.mdx, github-actions.mdx): spell out both token types —
    • Classic PAT → read:org scope
    • Fine-grained PAT → Organization permissions → Members → Read-only (the equivalent), noting a fine-grained PAT is bound to a single resource owner.
    • Also clarified read:user is not required.
  • Test (github_at_test.go): cover the maxOrgMembershipPages pagination cap — when every page is full, the exchange fails closed (no token) rather than returning a possibly-truncated org grant. This path was previously untested.
  • Comment (github_at.go): qualify the X-GitHub-SSO 403 check as best-effort — we have not confirmed the memberships list endpoint emits that header on SSO enforcement (it may just omit the org). The check is safe either way, but the comment no longer overstates it as a guarantee.

Verification (live, against staging)

Confirmed by exchanging real tokens for rdimitrov on staging.registry.modelcontextprotocol.io:

  • Classic read:org PAT across 16 real org memberships → the JWT granted exactly the 8 admin orgs + personal namespace, and zero of the 8 member orgs (incl. stacklok, modelcontextprotocol) — the core fix(auth): grant org namespace only to org Owners, not all members #1383 behavior, working.
  • Fine-grained PAT: without Members:read → personal namespace only (fail-closed); after adding Members:read → the org (Owner) namespace is granted. This is what the new docs describe.

No runtime behavior change here beyond the added test; the docs and comment are the substance.

rdimitrov and others added 2 commits July 11, 2026 01:18
The org-namespace guidance only mentioned the classic `read:org` scope, so a
user who mints a fine-grained PAT (GitHub's recommended token type) gets their
personal namespace only, with no hint why org publishing silently doesn't work.

Document both token types: classic PATs need `read:org`; fine-grained PATs need
"Organization permissions → Members → Read-only" (the equivalent), and are bound
to a single resource owner. Also note `read:user` is not required.

Verified against staging: a fine-grained PAT without Members:read is granted only
the personal namespace; after adding it, the org (Owner role) namespace is granted.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…omment

- Add a test that the org-memberships pagination fails closed (no token issued)
  when every page is full and the loop hits maxOrgMembershipPages, rather than
  returning a possibly-truncated org grant.
- Qualify the X-GitHub-SSO comment: it's a best-effort defensive check. We have
  not confirmed the memberships list endpoint emits X-GitHub-SSO on SSO
  enforcement (it may just omit the org); the check is safe either way but is
  not a proven guarantee that every SSO-blocked Owner is caught.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rdimitrov rdimitrov merged commit 9e762b0 into main Jul 10, 2026
7 checks passed
@rdimitrov rdimitrov deleted the docs/finegrained-pat-org-publishing branch July 10, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant